import App from './App'

// #ifndef VUE3
import Vue from 'vue'
import store from './store/index.js'
import uView from '@/uni_modules/uview-ui'
import './css/index.scss';
Vue.use(uView)
Vue.prototype.$store = store
Vue.config.productionTip = false

Vue.filter('newDate', function (value, type) {
	if (!value) return ''
	let date = new Date(parseInt(value) * 1000);
	let y = date.getFullYear();
	let m = (date.getMonth() + 1 + '').padStart(2, '');
	let d = (date.getDate() + '').padStart(2, '0');
	let h = date.getHours();
	let minute = date.getMinutes();
	let second = date.getSeconds();
	minute = minute < 10 ? "0" + minute : minute;
	second = second < 10 ? "0" + second : second;
	switch (type) {
		case 'year':
			return `${m}月${d}日 ${h}:${minute}:${second}`
			break;
		case 'rq':
			return `${y}年${m}月${d}日 ${h}:${minute}`
			break;
		case 'nyr':
			return `${y}年${m}月${d}日 `
			break;
		case 'ymd':
			return `${y}-${m}-${d}`
			break;
		case 'hour':
			return `${h}:${minute}`
			break;
		case 'second':
			return `${h}:${minute}:${second}`
			break;
		default:
			// return `${y}-${m}-${d} ${h}:${minute}:${second}`
			return `${y}-${m}-${d} ${h}:${minute}`
	}
})
//寄修专用
Vue.filter('newDateTwo', function (value, type) {
	if (!value) return ''
	let date = new Date(parseInt(value));
	let y = date.getFullYear();
	let m = (date.getMonth() + 1 + '').padStart(2, '');
	let d = (date.getDate() + '').padStart(2, '0');
	let h = date.getHours();
	let minute = date.getMinutes();
	let second = date.getSeconds();
	minute = minute < 10 ? "0" + minute : minute;
	second = second < 10 ? "0" + second : second;
	switch (type) {
		case 'year':
			return `${m}月${d}日 ${h}:${minute}:${second}`
			break;
		case 'rq':
			return `${y}年${m}月${d}日 ${h}:${minute}`
			break;
		case 'nyr':
			return `${y}年${m}月${d}日 `
			break;
		case 'ymd':
			return `${y}-${m}-${d}`
			break;
		case 'hour':
			return `${h}:${minute}`
			break;
		case 'second':
			return `${h}:${minute}:${second}`
			break;
		default:
			// return `${y}-${m}-${d} ${h}:${minute}:${second}`
			return `${y}-${m}-${d} ${h}:${minute}`
	}
})

App.mpType = 'app'
const app = new Vue({
    ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app, store
  }
}
// #endif